<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <t:base type="jquery,easyui,tools,DatePicker,ckeditor"></t:base>
    <link rel="stylesheet" href="${webRoot}/plug-in/lhgDialog/skins/blue.css"/>
    <link rel="stylesheet" href="${webRoot}/plug-in/lhgDialog/skins/default.css"/>
    <script type="text/javascript" src="${webRoot}/plug-in/ajaxfileupload/ajaxfileupload.js"></script>
    <script type="text/javascript" charset="utf-8"
            src="${webRoot}/plug-in/ueditor1_4_3-utf8-jsp/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8"
            src="${webRoot}/plug-in/ueditor1_4_3-utf8-jsp/ueditor.all.min.js"></script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8"
            src="${webRoot}/plug-in/ueditor1_4_3-utf8-jsp/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" charset="utf-8" src="${webRoot}/plug-in/QQgeo/geo.js"></script>
    <script type="text/javascript" charset="utf-8" src="${webRoot}/plug-in/My97DatePicker/WdatePicker.js"></script>

    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .clearfix:after {
            content: ".";
            display: block;
            clear: both;
            visibility: hidden;
            line-height: 0;
            height: 0;
        }

        * html .clearfix {
            zoom: 1;
        }

        .questionList {
            position: relative;
            padding: 10px 10px 10px 20px;
            min-height: 30px;
            font-size: 14px;
            border: 1px solid #f0f0f0;
            margin-bottom: 10px;
        }

        .questionList:hover {
            background: #f0f0f0;
        }

        .questionList label {
            position: absolute;
            left: 10px;
            top: 10px;
            line-height: 20px;
            font-weight: bold;
        }

        .questionList .row {
            position: relative;
            padding-left: 80px;
            line-height: 20px;
            min-height: 20px;
            margin-bottom: 10px;
        }

        .questionList .rowName {
            position: absolute;
            left: 0;
            width: 70px;
            text-align: right;
            color: #969696;
        }

        .questionList .type {
            float: right;
            margin-left: 15px;
        }

        .questionList .type span {
            color: #969696;
        }

        .questionList li, .questionList ul {
            list-style: none;
        }

        .questionList li {
            position: relative;
            min-height: 20px;
            margin-bottom: 5px;
        }

        .questionList li .answer {
            margin-left: 20px;
            color: #64d291;
        }

        .score {
            float: right;
            margin-left: 15px;
        }
    </style>

</head>
<body scroll="no">
<t:formvalid formid="addformobj" dialog="true" usePlugin="password" layout="table"
             action="questController.do?saveorupdate">
    <div class="new_table_list" id="showDiv">

    </div>
</t:formvalid>
<script type="text/javascript">
    $(function () {
        initData("${cqid}");
    });


    function initData(cqid) {
        var url = "cqDimResultController.do?getData_detail";
        $.ajax({
            url: url,
            async: true, // 注意此处需要同步
            type: "GET",
            dataType: "json",
            data: {cqid: cqid},
            success: function (data) {
                var showDiv = $("#showDiv");
                if (data.length == 0) {
                    showDiv.html('暂无分析结果');
                } else {
                    for (var i = 0; i < data.length; i++) {
                        var _html = "";
                        var question_no = data[i].question_no;
                        var ques_name = data[i].name;
                        var ques_type = data[i].typename;
                        var option_list = data[i].option_list;
                        _html += '<div class="questionList">';
                        _html += ' <label>' + question_no + '.</label>';
                        _html += '<div class="row"><span class="type"><span>类型：</span>' + ques_type + '</span><span class="rowName">问题：</span>' + ques_name + '</div>';
                        _html += '<div class="row">';
                        _html += '<span class="rowName">选择：</span>';
                        _html += ' <ul>';
                        var _option_html = "";
                        for (var m = 0; m < option_list.length; m++) {
                            var option_name = option_list[m].name;
                            var option_answer = option_list[m].answer;
                            _option_html += '<li>' + option_list[m].option_identity + ' . '
                            + option_name + '<span class="answer">' + option_answer + '</span><span class="score">' + option_list[m].score + '分</span></li>';

                        }
                        _html += _option_html;
                        _html += ' </ul></div></div>';
                        showDiv.append(_html);
                    }

                }
            }
        });
    }
</script>
</body>

</html>